import 'dart:convert';

import 'package:ichinesereader/models/student/AssignmentDetail.dart';
import 'package:ichinesereader/models/student/StudentItem.dart';

ClassStudentReportResult classStudentReportResultFromJson(String str) =>
    ClassStudentReportResult.fromJson(json.decode(str));

String classStudentReportResultToJson(ClassStudentReportResult data) =>
    json.encode(data.toJson());

class ClassStudentReportResult {
  ClassStudentReportResult({
    this.student,
    this.assignments,
    this.response,
  });

  StudentItem? student;
  dynamic assignments;
  Response? response;

  factory ClassStudentReportResult.fromJson(Map<String, dynamic> json) =>
      ClassStudentReportResult(
        student: StudentItem.fromJson(json["student"]),
        assignments: json["assignments"],
        response: Response.fromJson(json["response"]),
      );

  Map<String, dynamic> toJson() => {
        "student": student != null ? student?.toJson() : null,
        "assignments": assignments,
        "response": response != null ? response?.toJson() : null,
      };
}

class Response {
  Response({
    this.limit,
    this.page,
    this.count,
    this.list,
  });

  int? limit;
  int? page;
  int? count;
  List<ListAssingmentElement>? list;

  factory Response.fromJson(Map<String, dynamic> json) => Response(
        limit: json["limit"],
        page: json["page"],
        count: json["count"],
        list: json["list"] != null
            ? List<ListAssingmentElement>.from(
                json["list"].map((x) => ListAssingmentElement.fromJson(x)))
            : null,
      );

  Map<String, dynamic> toJson() => {
        "limit": limit,
        "page": page,
        "count": count,
        "list": list != null
            ? List<dynamic>.from(list!.map((x) => x.toJson()))
            : null,
      };
}

class ListAssingmentElement {
  ListAssingmentElement({
    this.assignment,
    this.readProgress,
    this.readStarted,
    this.readComplete,
    this.quizAttempted,
    this.quizPassed,
    this.bookProgress,
    this.overallProgress,
    this.overallCount,
    this.recording,
    this.writing,
  });

  AssignmentDetail? assignment;
  int? readProgress;
  bool? readStarted;
  bool? readComplete;
  bool? quizAttempted;
  bool? quizPassed;
  dynamic bookProgress;
  int? overallProgress;
  int? overallCount;
  bool? recording;
  bool? writing;

  factory ListAssingmentElement.fromJson(Map<String, dynamic> json) =>
      ListAssingmentElement(
        assignment: AssignmentDetail.fromJson(json["assignment"]),
        readProgress: json["readProgress"],
        readStarted: json["readStarted"],
        readComplete: json["readComplete"],
        quizAttempted: json["quizAttempted"],
        quizPassed: json["quizPassed"],
        bookProgress: json["bookProgress"],
        overallProgress: json["overallProgress"],
        overallCount: json["overallCount"],
        recording: json["recording"],
        writing: json["writing"],
      );

  Map<String, dynamic> toJson() => {
        "assignment": assignment != null ? assignment?.toJson() : null,
        "readProgress": readProgress,
        "readStarted": readStarted,
        "readComplete": readComplete,
        "quizAttempted": quizAttempted,
        "quizPassed": quizPassed,
        "bookProgress": bookProgress,
        "overallProgress": overallProgress,
        "overallCount": overallCount,
        "recording": recording,
        "writing": writing,
      };
}
